package com.abstractdemo;

/**
 * @Auther: shiquan
 * @Date: 2024/10/22 - 10 - 22 -10:07
 */
public abstract class Animal {
    //抽取共性，无法确定方法体，把方法定义为抽象
    //子类按照某种方方式重写
    //抽象类和抽象方法都有abstract
    private String name;
    private int age;

    public Animal() {
    }

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void drink(){
        System.out.println("动物在喝水");
    }

    public abstract void eat();////抽象方法，没有方法体，有abstract关键字做修饰



}
